dir_name="$(dirname $1)"

cat $1            | \
sed 's/```X.*$//' | \
awk -v dir_name=$dir_name '
BEGIN {file_name = ""}

/comment/ && /\.h/ { 
gsub (" ", "", $0);
if(split($0,a,"[()]")==3) file_name=a[2] 

}

/comment/ && ! /docautocomplete/ , /```/  { 
if ((! ($0 ~ /```/ )) && (! ($0 ~ /comment/ ) ))
    print $0 >> dir_name"/"file_name

}

' 

